package com.yn.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@AllArgsConstructor
@Getter
public enum PostStatusEnum {

    OUT_OF_SERVICE(0, "停运"),
    IN_SERVICE(1, "在运"),
    OFF_DUTY(3, "非在岗"),
    ON_DUTY(4, "在岗")
    ;



    private Integer code;

    private String name;

    public static PostStatusEnum getByCode(Integer code) {
        if(null == code) {
            return null;
        }
        for(PostStatusEnum postStatusEnum : PostStatusEnum.values()) {
            if(postStatusEnum.getCode() == code) {
                return postStatusEnum;
            }
        }
        return null;
    }

}